<?php
return array(
	'class' => 'coms.configParser.GoodsConfig',
	'attributeLabels' => array(
		'title' => '商品名称',
		'thumb' => '商品图片',
		'provider_id' => '供应商',
		'provider.worker_name' => '供应商',
		'priceInfo' => '基准价格信息',
		'profile' => '详细信息',
		'class',
		'object_type',
		'listing_status' => '上架状态',
		'type_id' => '商品分类',
		'create_time' => '创建时间',
		'is_recommend' => '是否推荐'
	),

	'relations' => array(
		'provider' => array(CActiveRecord::BELONGS_TO, 'WorkerAccount', 'provider_id'),
		'priceInfo' => array(CActiveRecord::HAS_ONE, 'GoodsPriceTime', 'goods_id'),
		'cate' => array(CActiveRecord::HAS_ONE, 'ProviderGoodsCateRelated', 'goods_id')
	),

	'cascade' => array(
		'profile', 'priceInfo','cate'
	),


	'behaviors' => array(
		'stateHandle' => array(
			'class' => 'application.modules.admin.components.ModelState',
			'handleField' => 'status',
			'configName' => 'status.goods.audit',
			'configReader' => Yii::app()->config,
			'initState' => 'ST_NONE',
		),
		'listingStateHandle' => array(
			'class' => 'application.modules.admin.components.ModelState',
			'handleField' => 'listing_status',
			'configName' => 'status.goods.listing',
			'configReader' => Yii::app()->config,
			'initState' => 'ST_NONE',
		),
		'providerIdSolve' => array(
			'class' => 'coms.behaviors.goods.ProviderIdSolve',
		),
		'listingScopes'=>array(
			'class'=>'coms.behaviors.goods.ListingBehavior',
		),
		'TurnoverPriceGetter' => array(
			'class'=>'coms.behaviors.goods.TurnoverPriceGetter',
		),
		'shopVurl' => array(
			'class'=>'coms.behaviors.goods.ShopVurlBehavior',
		),
		'timeprice' => array(
			'class'=>'coms.behaviors.goods.TimePriceBehavior',
		),
		'sellRanking' => array(
			'class'=>'coms.behaviors.goods.SellRankingBehavior',
		),
	),

	'rules' => array(
		array('price','safe'),
		array('thumb','required'),
		array('provider_id', 'required'),
		array('provider_id', 'coms.validators.goods.GoodsProviderValidator'),
	),

	'tableName' => 'goods',

	'_import' => array(
		array('*', 'models.ContentBase//*'),
	),
);

?>